home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / codeli_1 / setup.exe / _SETUP.1 / frmCoolbar.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-21  |  18.7 KB  |  488 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmCoolbar 
  4.    Caption         =   "Creating Coolbars from the Standard Toolbar Control"
  5.    ClientHeight    =   2535
  6.    ClientLeft      =   3660
  7.    ClientTop       =   2520
  8.    ClientWidth     =   6495
  9.    Icon            =   "frmCoolbar.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   2535
  13.    ScaleWidth      =   6495
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.DriveListBox Drive1 
  16.       Height          =   315
  17.       Left            =   4200
  18.       TabIndex        =   0
  19.       Top             =   1590
  20.       Width           =   1740
  21.    End
  22.    Begin VB.PictureBox picTBContainer 
  23.       Appearance      =   0  'Flat
  24.       BackColor       =   &H80000005&
  25.       BorderStyle     =   0  'None
  26.       ForeColor       =   &H80000008&
  27.       Height          =   555
  28.       Index           =   1
  29.       Left            =   0
  30.       ScaleHeight     =   555
  31.       ScaleWidth      =   7860
  32.       TabIndex        =   3
  33.       Top             =   900
  34.       Width           =   7860
  35.       Begin ComctlLib.Toolbar Toolbar 
  36.          Height          =   600
  37.          Index           =   1
  38.          Left            =   120
  39.          TabIndex        =   5
  40.          Top             =   -15
  41.          Width           =   15000
  42.          _ExtentX        =   26458
  43.          _ExtentY        =   1058
  44.          ButtonWidth     =   2805
  45.          ButtonHeight    =   953
  46.          Appearance      =   1
  47.          ImageList       =   "ImageList2"
  48.          _Version        =   327680
  49.          BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  50.             NumButtons      =   3
  51.             BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  52.                Caption         =   "Best of the Web"
  53.                Object.ToolTipText     =   "Best of the Web"
  54.                Object.Tag             =   ""
  55.                ImageIndex      =   1
  56.             EndProperty
  57.             BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  58.                Caption         =   "Today's Links"
  59.                Object.ToolTipText     =   "Today's Links"
  60.                Object.Tag             =   ""
  61.                ImageIndex      =   1
  62.             EndProperty
  63.             BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  64.                Caption         =   "Microsoft Home"
  65.                Object.ToolTipText     =   "Microsoft Home"
  66.                Object.Tag             =   ""
  67.                ImageIndex      =   1
  68.             EndProperty
  69.          EndProperty
  70.       End
  71.    End
  72.    Begin VB.PictureBox picTBContainer 
  73.       Appearance      =   0  'Flat
  74.       BackColor       =   &H80000005&
  75.       BorderStyle     =   0  'None
  76.       ForeColor       =   &H80000008&
  77.       Height          =   795
  78.       Index           =   0
  79.       Left            =   0
  80.       ScaleHeight     =   795
  81.       ScaleWidth      =   7860
  82.       TabIndex        =   2
  83.       Top             =   30
  84.       Width           =   7860
  85.       Begin ComctlLib.Toolbar Toolbar 
  86.          Height          =   840
  87.          Index           =   0
  88.          Left            =   120
  89.          TabIndex        =   4
  90.          Top             =   -15
  91.          Width           =   15000
  92.          _ExtentX        =   26458
  93.          _ExtentY        =   1482
  94.          ButtonWidth     =   1323
  95.          ButtonHeight    =   1376
  96.          Appearance      =   1
  97.          ImageList       =   "ImageList1"
  98.          _Version        =   327680
  99.          BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  100.             NumButtons      =   8
  101.             BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  102.                Caption         =   "Back"
  103.                Object.ToolTipText     =   "Back"
  104.                Object.Tag             =   ""
  105.                ImageIndex      =   1
  106.             EndProperty
  107.             BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  108.                Caption         =   "Forward"
  109.                Object.ToolTipText     =   "Forward"
  110.                Object.Tag             =   ""
  111.                ImageIndex      =   2
  112.             EndProperty
  113.             BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  114.                Caption         =   "Stop"
  115.                Object.ToolTipText     =   "Stop"
  116.                Object.Tag             =   ""
  117.                ImageIndex      =   3
  118.             EndProperty
  119.             BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  120.                Caption         =   "Refresh"
  121.                Object.ToolTipText     =   "Refresh"
  122.                Object.Tag             =   ""
  123.                ImageIndex      =   4
  124.             EndProperty
  125.             BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  126.                Caption         =   "Home"
  127.                Object.ToolTipText     =   "Home"
  128.                Object.Tag             =   ""
  129.                ImageIndex      =   5
  130.             EndProperty
  131.             BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  132.                Caption         =   "Search"
  133.                Object.ToolTipText     =   "Search"
  134.                Object.Tag             =   ""
  135.                ImageIndex      =   6
  136.             EndProperty
  137.             BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  138.                Caption         =   "Favorites"
  139.                Object.ToolTipText     =   "Favorites"
  140.                Object.Tag             =   ""
  141.                ImageIndex      =   7
  142.             EndProperty
  143.             BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  144.                Caption         =   "Print"
  145.                Object.ToolTipText     =   "Print"
  146.                Object.Tag             =   ""
  147.                ImageIndex      =   8
  148.             EndProperty
  149.          EndProperty
  150.       End
  151.    End
  152.    Begin VB.PictureBox picTBContainer 
  153.       Appearance      =   0  'Flat
  154.       BackColor       =   &H80000005&
  155.       BorderStyle     =   0  'None
  156.       ForeColor       =   &H80000008&
  157.       Height          =   345
  158.       Index           =   2
  159.       Left            =   0
  160.       ScaleHeight     =   345
  161.       ScaleWidth      =   7860
  162.       TabIndex        =   1
  163.       Top             =   1560
  164.       Width           =   7860
  165.       Begin ComctlLib.Toolbar Toolbar 
  166.          Height          =   420
  167.          Index           =   2
  168.          Left            =   120
  169.          TabIndex        =   6
  170.          Top             =   -15
  171.          Width           =   15000
  172.          _ExtentX        =   26458
  173.          _ExtentY        =   741
  174.          ButtonWidth     =   635
  175.          ButtonHeight    =   582
  176.          Appearance      =   1
  177.          ImageList       =   "ImageList3"
  178.          _Version        =   327680
  179.          BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  180.             NumButtons      =   11
  181.             BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  182.                Object.ToolTipText     =   "New"
  183.                Object.Tag             =   ""
  184.                ImageIndex      =   1
  185.             EndProperty
  186.             BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  187.                Object.ToolTipText     =   "Open"
  188.                Object.Tag             =   ""
  189.                ImageIndex      =   2
  190.             EndProperty
  191.             BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  192.                Object.ToolTipText     =   "Save"
  193.                Object.Tag             =   ""
  194.                ImageIndex      =   3
  195.             EndProperty
  196.             BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  197.                Object.ToolTipText     =   "Cut"
  198.                Object.Tag             =   ""
  199.                ImageIndex      =   4
  200.             EndProperty
  201.             BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  202.                Object.ToolTipText     =   "Copy"
  203.                Object.Tag             =   ""
  204.                ImageIndex      =   5
  205.             EndProperty
  206.             BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  207.                Object.ToolTipText     =   "Paste"
  208.                Object.Tag             =   ""
  209.                ImageIndex      =   6
  210.             EndProperty
  211.             BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  212.                Object.ToolTipText     =   "Delete"
  213.                Object.Tag             =   ""
  214.                ImageIndex      =   7
  215.             EndProperty
  216.             BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  217.                Object.ToolTipText     =   "Find"
  218.                Object.Tag             =   ""
  219.                ImageIndex      =   8
  220.             EndProperty
  221.             BeginProperty Button9 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  222.                Object.ToolTipText     =   "Undo"
  223.                Object.Tag             =   ""
  224.                ImageIndex      =   9
  225.             EndProperty
  226.             BeginProperty Button10 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  227.                Object.ToolTipText     =   "Redo"
  228.                Object.Tag             =   ""
  229.                ImageIndex      =   10
  230.             EndProperty
  231.             BeginProperty Button11 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  232.                Object.ToolTipText     =   "Help"
  233.                Object.Tag             =   ""
  234.                ImageIndex      =   11
  235.             EndProperty
  236.          EndProperty
  237.          BorderStyle     =   1
  238.       End
  239.    End
  240.    Begin VB.Label Label2 
  241.       Alignment       =   1  'Right Justify
  242.       AutoSize        =   -1  'True
  243.       Caption         =   "http://www.geocities.com/SiliconValley/Way/6445"
  244.       BeginProperty Font 
  245.          Name            =   "MS Sans Serif"
  246.          Size            =   8.25
  247.          Charset         =   0
  248.          Weight          =   700
  249.          Underline       =   0   'False
  250.          Italic          =   0   'False
  251.          Strikethrough   =   0   'False
  252.       EndProperty
  253.       ForeColor       =   &H00800000&
  254.       Height          =   195
  255.       Left            =   2085
  256.       TabIndex        =   8
  257.       Top             =   2280
  258.       Width           =   4365
  259.    End
  260.    Begin VB.Label Label1 
  261.       Alignment       =   1  'Right Justify
  262.       AutoSize        =   -1  'True
  263.       Caption         =   "Written for the VB Center Code Library"
  264.       BeginProperty Font 
  265.          Name            =   "Small Fonts"
  266.          Size            =   6.75
  267.          Charset         =   0
  268.          Weight          =   400
  269.          Underline       =   0   'False
  270.          Italic          =   0   'False
  271.          Strikethrough   =   0   'False
  272.       EndProperty
  273.       Height          =   165
  274.       Left            =   4065
  275.       TabIndex        =   7
  276.       Top             =   2040
  277.       Width           =   2355
  278.    End
  279.    Begin ComctlLib.ImageList ImageList3 
  280.       Left            =   1200
  281.       Top             =   1920
  282.       _ExtentX        =   1005
  283.       _ExtentY        =   1005
  284.       BackColor       =   -2147483643
  285.       ImageWidth      =   16
  286.       ImageHeight     =   16
  287.       MaskColor       =   12632256
  288.       _Version        =   327680
  289.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  290.          NumListImages   =   11
  291.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  292.             Picture         =   "frmCoolbar.frx":0442
  293.             Key             =   ""
  294.          EndProperty
  295.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  296.             Picture         =   "frmCoolbar.frx":0554
  297.             Key             =   ""
  298.          EndProperty
  299.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  300.             Picture         =   "frmCoolbar.frx":0666
  301.             Key             =   ""
  302.          EndProperty
  303.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  304.             Picture         =   "frmCoolbar.frx":0778
  305.             Key             =   ""
  306.          EndProperty
  307.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  308.             Picture         =   "frmCoolbar.frx":088A
  309.             Key             =   ""
  310.          EndProperty
  311.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  312.             Picture         =   "frmCoolbar.frx":099C
  313.             Key             =   ""
  314.          EndProperty
  315.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  316.             Picture         =   "frmCoolbar.frx":0AAE
  317.             Key             =   ""
  318.          EndProperty
  319.          BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  320.             Picture         =   "frmCoolbar.frx":0BC0
  321.             Key             =   ""
  322.          EndProperty
  323.          BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  324.             Picture         =   "frmCoolbar.frx":0CD2
  325.             Key             =   ""
  326.          EndProperty
  327.          BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  328.             Picture         =   "frmCoolbar.frx":0DE4
  329.             Key             =   ""
  330.          EndProperty
  331.          BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  332.             Picture         =   "frmCoolbar.frx":0EF6
  333.             Key             =   ""
  334.          EndProperty
  335.       EndProperty
  336.    End
  337.    Begin ComctlLib.ImageList ImageList2 
  338.       Left            =   600
  339.       Top             =   1920
  340.       _ExtentX        =   1005
  341.       _ExtentY        =   1005
  342.       BackColor       =   -2147483643
  343.       ImageWidth      =   16
  344.       ImageHeight     =   16
  345.       MaskColor       =   12632256
  346.       _Version        =   327680
  347.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  348.          NumListImages   =   1
  349.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  350.             Picture         =   "frmCoolbar.frx":1008
  351.             Key             =   ""
  352.          EndProperty
  353.       EndProperty
  354.    End
  355.    Begin ComctlLib.ImageList ImageList1 
  356.       Left            =   0
  357.       Top             =   1920
  358.       _ExtentX        =   1005
  359.       _ExtentY        =   1005
  360.       BackColor       =   -2147483643
  361.       ImageWidth      =   32
  362.       ImageHeight     =   32
  363.       MaskColor       =   12632256
  364.       _Version        =   327680
  365.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  366.          NumListImages   =   8
  367.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  368.             Picture         =   "frmCoolbar.frx":1322
  369.             Key             =   ""
  370.          EndProperty
  371.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  372.             Picture         =   "frmCoolbar.frx":163C
  373.             Key             =   ""
  374.          EndProperty
  375.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  376.             Picture         =   "frmCoolbar.frx":1956
  377.             Key             =   ""
  378.          EndProperty
  379.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  380.             Picture         =   "frmCoolbar.frx":1C70
  381.             Key             =   ""
  382.          EndProperty
  383.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  384.             Picture         =   "frmCoolbar.frx":1F8A
  385.             Key             =   ""
  386.          EndProperty
  387.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  388.             Picture         =   "frmCoolbar.frx":22A4
  389.             Key             =   ""
  390.          EndProperty
  391.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  392.             Picture         =   "frmCoolbar.frx":25BE
  393.             Key             =   ""
  394.          EndProperty
  395.          BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  396.             Picture         =   "frmCoolbar.frx":28D8
  397.             Key             =   ""
  398.          EndProperty
  399.       EndProperty
  400.    End
  401. Attribute VB_Name = "frmCoolbar"
  402. Attribute VB_GlobalNameSpace = False
  403. Attribute VB_Creatable = False
  404. Attribute VB_PredeclaredId = True
  405. Attribute VB_Exposed = False
  406. Private Rebar As New CRebar
  407. Public Sub RefreshToolbars()
  408. On Error Resume Next
  409. Dim xCount As Integer
  410. For xCount = 0 To Toolbar.Count - 1
  411.     Toolbar(xCount).Refresh
  412. End Sub
  413. Private Sub Form_Load()
  414. ' move toolbar to the left to hide
  415. ' left border
  416.     Toolbar(0).Left = -15
  417.     Toolbar(1).Left = -15
  418.     Toolbar(2).Left = -15
  419. ' Make the height
  420. ' It makes the pictures be on the left and the text on the right
  421. picTBContainer(1).Height = 340
  422. Rebar.TBMakeFlat Toolbar(0)
  423. ' making this toolbar's style list.
  424. Rebar.TBMakeFlat Toolbar(1), True
  425. Rebar.TBMakeFlat Toolbar(2)
  426. ' Create The Rebar
  427. With Rebar
  428. Set .Parent = Me
  429.     .Create
  430. End With
  431. ' Add the bands with the child
  432. ' Syntax(on a single line):
  433. ' Rebar.AddBands (BandText As String,
  434. ' BandName As Integer, ChildWin,
  435. ' NewRow As BandPosition, [mWidth])
  436. Rebar.AddBands "", 0, picTBContainer(0).hwnd, 0, 10
  437. Rebar.AddBands "Links ", 1, picTBContainer(1).hwnd, 0, 10
  438. Rebar.AddBands "", 2, picTBContainer(2).hwnd, 0, 10
  439. Rebar.AddBands "", 3, Drive1.hwnd, 1, 10
  440. Me.Show
  441. picTBContainer(2).SetFocus
  442. End Sub
  443. Public Sub ProcMsg(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, Result As Long)
  444. On Error Resume Next
  445. Dim hdr As NMHDR
  446. Dim RebarHdr As NMREBAR
  447. Dim BandInfo As RBHITTESTINFO
  448. Dim ptApi As POINTAPI
  449. Dim xReturn As Long
  450. Dim BandId As Integer
  451. Select Case uMsg
  452. Case WM_NOTIFY 'Needed to let us know when mouse has anything to do with Rebar
  453. ' Copy hdr info so we can determine if uMsg is coming from Rebar
  454. ' CopyMemory hdr, ByVal lParam, Len(hdr)
  455. CopyMemory RebarHdr, ByVal lParam, Len(RebarHdr)
  456. ' Check hwndFrom (handle of window sending message)
  457. ' If hdr.hwndFrom = Rebar.GetRebarWindow Then
  458. If RebarHdr.NMHDR = Rebar.GetRebarWindow Then
  459. Call GetCursorPos(ptApi)
  460. Call ScreenToClient(Me.hwnd, ptApi)
  461. BandInfo.ptApi = ptApi
  462. BandInfo.flags = RBHT_CAPTION Or RBHT_GRABBER Or RBHT_CLIENT
  463. Call SendMessage(Rebar.GetRebarWindow, RB_HITTEST, 0, BandInfo)
  464. ' Yes it's ours
  465. ' 8386744 = Being Sized
  466. ' 8387324 = ClickUp anywhere on rebar or gripper
  467. ' If you don't do this when using the toolbar control, then
  468. ' whenever you touch the Rebar or size the bands then
  469. ' toolbars will dissappear.
  470. ' A lot of Flicker
  471. If lParam = 8386744 Then RefreshToolbars
  472. If lParam = 8387324 Then RefreshToolbars
  473. ' older Version
  474. If lParam = 8386792 Then RefreshToolbars
  475. End If
  476. ' Case User changes colors while this is running
  477. Case WM_SYSCOLORCHANGE
  478. Rebar.SetBandColors
  479. End Select
  480. End Sub
  481. Private Sub Form_Resize()
  482. On Error Resume Next
  483. Rebar.Resize Me
  484. End Sub
  485. Private Sub Form_Unload(Cancel As Integer)
  486.     Rebar.DestroyRebar
  487. End Sub
  488.